package org.ala.tiktools.sharddb.tx.spring;

import org.ala.tiktools.sharddb.db.ShardDatasource;
import org.ala.tiktools.sharddb.tx.ShardDataSourceTransactionManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * 事务管理器
 *
 * @author ala
 * @date 2024-12-30 09:26
 */
@Configuration
public class ShardDBTxConfiguration {


    /**
     *  分库事务管理器
     */
    @Bean(value="shardDataSourceTransactionManager")
    public ShardDataSourceTransactionManager shardDataSourceTransactionManager(ShardDatasource shardDatasource) {
        ShardDataSourceTransactionManager txm = new ShardDataSourceTransactionManager();
        txm.setDataSource(shardDatasource);
        return txm;
    }
}
